#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
    printf("父进程pid：%d\n", getpid());
    pid_t id = fork();
    if(id < 0) {
        return 1;//fork失败，异常退出
    }else if(id == 0) {
        printf("子进程经此\n");
    }else {
        printf("父进程经此\n");
    }
    return 0;
}
